{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import openpyxl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "outputs": [
    {
     "data": {
      "text/plain": "<Worksheet \"1季度利润表\">"
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "myBook=openpyxl.load_workbook('利润表.xlsx')\n",
    "mySheet=myBook['1季度利润表']\n",
    "mySheet"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5967190000\n",
      "5967190000\n",
      "4570920000\n",
      "3088390000\n",
      "999810000\n",
      "80140000\n",
      "235180000\n",
      "168290000\n",
      "165250000\n",
      "11980000\n",
      "1567650000\n",
      "18670000\n",
      "4280000\n",
      "1582050000\n",
      "394160000\n",
      "1187890000\n"
     ]
    }
   ],
   "source": [
    "for i in range(5,45):\n",
    "    myValue=mySheet.cell(i,1).value\n",
    "    myValue=myValue[0:-4]+'(元)'\n",
    "    mySheet.cell(i,1).value=myValue\n",
    "    myValue=mySheet.cell(i,2).value\n",
    "    if myValue is not None:\n",
    "        myValue=myValue*10000\n",
    "        mySheet.cell(i,2).value=myValue\n",
    "        print(myValue)"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "outputs": [],
   "source": [
    "myBook.save('结果表-利润表.xlsx')"
   ],
   "metadata": {
    "collapsed": false
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
